import { host } from './global.config';
import { TestConfigEntity } from './test.entity';

const userName = 'admin';
const password = 'worktile111111';

export const LoginConfig: TestConfigEntity = {
  title: '登录模块测试',
  screenshotName: 'login_tests',
  pageUrl: `${host.url}/signin`, // 登录页面url
  from: [
    {
      type: 'fill',
      name: 'userName',
      selector: 'input[name="account"]',
      label: '用户名',
      value: userName,
      err_msg: ['手机号/邮箱不能为空'],
    },
    {
      type: 'fill',
      selector: 'input[type="password"]',
      name: 'password',
      label: '密码',
      value: password,
      err_msg: ['密码不能为空'],
    },
    {
      type: 'click',
      name: 'loginBtn',
      selector: 'button:has-text("登录")',
    },
  ],
  testPage: {
    pageUrl: `${host.url}`, // 登录页面url
    btnGroup: [
      {
        type: 'click',
        name: 'userBtn',
        selector: '.app-nav-area .bottom-area .thy-avatar',
      },
    ],
    result: [
      {
        id: '101',
        type: 'text',
        selector: '.action-menu .action-menu-item .info-wrap .name',
        des: '测试用户登录成功(用户名等于帐号设置页面的姓名)',
        value: userName,
      },
    ],
  },
};
